package com.iespring.util;

import com.iespring.bean.admin.user.entity.MallUser;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.subject.Subject;

/**
<<<<<<< HEAD
 * Auth: 杨宇健
 * Time: 2023/1/1 15:04
 * Description: 获取用户信息
 **/
/**
 * 获取用户信息
 *
 * @author xD
 * @since 2023/01/01 15:52
 */
public class UserInfoUtils {
    public static MallUser getUser() {
        MallUser user = null;
        Subject subject = SecurityUtils.getSubject();
        PrincipalCollection principals = subject.getPrincipals();
        if (principals != null) {
            user = (MallUser) principals.getPrimaryPrincipal();
        }
        return user;
    }
}
